# include <stdio.h>
# define M 4
# define N 6
int main()
{
	int x,y,z;
	double j;
	double a[M+1][N+1]={0};
	for (x=0;x<M;x++)
	{
		for (y=0;y<N;y++)
		{
			scanf("%lf",&j);
			a[x][y]=j;
			a[x][N]+=j;
		}
	}
	for (y=0;y<N;y++)
	{
		for (x =0;x<M;x++)
		{
			z=a[x][y];
			a[M][y]+=z;
		}
	}
	for (x=0;x<M;x++)
	a[x][N]=a[x][N]/N;
	for (y=0;y<N;y++)
	a[M][y]=a[M][y]/M;
	for (x=0;x<M;x++)
	{
		for (y=0;y<=N;y++)
		printf("%.2f  ",a[x][y]);
		printf("\n");
	}
	for (y=0;y<N;y++)
	printf("%.2f  ",a[M][y]);
	return 0;
}
/*
87 88 89 89 75 76
77 78 79 80 81 81 
90 91 92 93 94 87
65 66 67 68 69 66
*/
